-
Notifications
You must be signed in to change notification settings - Fork 730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: tickLabelProps dy and dx work again #271
Conversation
Clever solution! My only thought is how this might play with rotating the text. Will give this branch a go locally when I get a chance and report back |
Does this work on all (our supported) browsers? I remember reading that css transforms did not work on IE. It would be nice to support IE 11 if possible, although I know it's on it's way out (github is dropping it in a few months). |
From caniuse about IE11.
All versions of Edge have the same problem unfortunately. I can change it to use the transform attribute which means that |
The problem of transforming Would it be a good tradeoff to set a default That would get rid of the transforms, uses the correct svg attributes and works in supported browsers. |
@sto3psl Since adding |
Another thought is could you use reduce-css-calc like we are for change: const x = textProps.x + dx;
const y = textProps.y + dy; to const x = reduceCSSCalc(`calc(${textProps.x}) + ${dx}`);
const y = reduceCSSCalc(`calc(${textProps.y}) + ${dy}`); |
Wrapping The problem with
And |
@sto3psl oh, I thought it handled mixed units, but I see it does not. Hopefully the |
Ok I played with svg a little and |
Our Group uses If this doesn't work, the |
Svg transforms are unitless which means transforming |
@sto3psl sounds like |
The
Thanks for all the input and thoughts on this @techniq. If there is anything else let me know, this was quite fun to think about 😄. |
LGTM thanks for the contribution @sto3psl! |
This should fix the bug mentioned in #267.
I had several problems with this which made me come to the solution of using transforms for this bug fix.
px
values fordx
anddy
were fine and worked.em
values were fine as long asfontSize
was explicitly provided for<Text />
. WithoutfontSize
there is no value to use for the transformation fromem -> px
without accessing the DOM.rem
units had the same problem that there is no way of transforming topx
without the DOM.<text dy="1em">...</text>
because the child<tspan>
defines ady
value that overwrites the one from<text>
. I'm not quite sure why. exampleIn the end setting a CSS transform seemed like the easiest solution and has the nice benefit of supporting
rem
.If there is a better solution please let me know, this took longer than I want to admit 😅.
🐛 Bug Fix
@vx/text
supportdx
anddy
again